//package cc.tuhaolicai.mt.user.mobile.business.repay;
//
//import cc.tuhaolicai.mt.predefined.constant.SysConfigConstant;
//import cc.tuhaolicai.mt.service.exception.service.PayerErrorException;
//import cc.tuhaolicai.mt.service.service.union.pays.ThirdPartyService;
//import cc.tuhaolicai.mt.user.mobile.business.handler.BusinessHandler;
//import com.google.common.collect.Maps;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import pro.tools.data.text.ToolJson;
//import pro.tools.data.text.ToolStr;
//
//import java.io.UnsupportedEncodingException;
//import java.net.URLDecoder;
//import java.util.List;
//import java.util.Map;
//
///**
// * 还款第三方异步返回数据处理
// *
// * @author chenli
// * @create 2017-10-11
// */
//public class PayerParamHandler extends BusinessHandler {
//
//    private static final Logger log = LoggerFactory.getLogger(PayerParamHandler.class);
//
//    @SuppressWarnings("unchecked")
//    @Override
//    public void coreExecute() {
//        ThirdPartyService thirdPartyService = (ThirdPartyService)params.get("thirdPartyService");
//        Map<String,Object> received = (Map<String,Object>)params.get("received");
//
//        if(myFlag){
//            TransferReturn transferReturn = thirdPartyService.payPlatformTransferReturn(received);
//            if (transferReturn == null) {
//                log.info(SysConfigConstant.MY_LOG_NID+"还款操作异步回调service:校验参数失败");
//                throw new PayerErrorException("校验第三方返回数据失败");
//            }
//
//            String loanJsonList = transferReturn.getLoanJsonList();
//            try {
//                loanJsonList = URLDecoder.decode(loanJsonList, "UTF-8");
//            } catch (UnsupportedEncodingException e) {
//                e.printStackTrace();
//                log.info(SysConfigConstant.MY_LOG_NID+"还款操作异步回调service:解码失败");
//                throw new PayerErrorException("还款第三方回调返回数据有误，解码失败");
//            }
//            List<TransferReturnJsonList> transferReturnJsonLists = ToolJson.jsonToModelList(loanJsonList, TransferReturnJsonList.class);
//            if (ToolStr.isBlank(transferReturn.getRemark2())) {
//                log.info(SysConfigConstant.MY_LOG_NID+"还款操作异步回调service:remark2不能为空");
//                throw new PayerErrorException("还款第三方回调返回数据有误，remark2不能为空");
//            }
//        }
//        if(nextFlag){
//            Map<String,Object> nextParams = Maps.newHashMap();
//            nextHandler.addParams(nextParams);
//            nextHandler.execute();
//        }
//    }
//}